//
//  SISSCoopContractShowViewController.m
//  SISSAPP
//
//  Created by 袁应荣 on 2019/7/17.
//  Copyright © 2019 优房网. All rights reserved.
//

#import "SISSCoopContractShowViewController.h"
#import "SISSUploadCoopContractViewController.h"
#import "SISSNetworkingManager+CoopProgress.h"

@interface SISSCoopContractShowViewController ()

///
@property (strong, nonatomic) SISSIntermediaryContractModel *intermediaryContractModel;

@end

@implementation SISSCoopContractShowViewController

- (void)viewDidLoad {
    self.isHiddenDateChooseView = YES;
    [super viewDidLoad];
    
    [self requestCoopContractData];
}

- (void)requestCoopContractData {
    
    WeakSelf
    
    if (self.contractType == 1) {
        [kNetworkManager requestIntermediaryContractWithAbpId:self.abpId success:^(SISSIntermediaryContractModel *intermediaryContractModel) {
            
            weakSelf.intermediaryContractModel = intermediaryContractModel;
            weakSelf.contractNoView.rightStr = intermediaryContractModel.contractNum;
            weakSelf.remarkView.rightStr = intermediaryContractModel.otherdesc;
            weakSelf.createDateView.rightStr = intermediaryContractModel.insertTime;
            weakSelf.uploadImageShowView.imageUrlArr = intermediaryContractModel.image.mutableCopy;
            
        } failed:^(NSError *error) {
            NSLog(@"%@",error);
        }];
    } else if (self.contractType == 2) {
        [kNetworkManager requestBusinesscontractWithAbpId:self.abpId success:^(SISSIntermediaryContractModel *intermediaryContractModel) {
            
            weakSelf.intermediaryContractModel = intermediaryContractModel;
            weakSelf.contractNoView.rightStr = intermediaryContractModel.contractNum;
            weakSelf.remarkView.rightStr = intermediaryContractModel.otherdesc;
            weakSelf.createDateView.rightStr = intermediaryContractModel.insertTime;
            weakSelf.uploadImageShowView.imageUrlArr = intermediaryContractModel.image.mutableCopy;
            
        } failed:^(NSError *error) {
            NSLog(@"%@",error);
        }];
    }
    
   

}

- (void)modifyButtonClickAction {
    SISSUploadCoopContractViewController *vc = [[SISSUploadCoopContractViewController alloc] init];
    vc.abpId = self.abpId;
    vc.isHouseCooperatonIn = self.isHouseCooperatonIn;
    vc.contractType = self.contractType;
    vc.intermediaryContractModel = self.intermediaryContractModel;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
